load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "chunk",
    srcs = [
        "alloc.go",
        "chunk.go",
        "chunk_in_disk.go",
        "chunk_util.go",
        "codec.go",
        "column.go",
        "compare.go",
        "iterator.go",
        "list.go",
        "mutrow.go",
        "pool.go",
        "row.go",
        "row_container.go",
        "row_container_reader.go",
        "row_in_disk.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/util/chunk",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/types",
        "//pkg/util/checksum",
        "//pkg/util/disk",
        "//pkg/util/encrypt",
        "//pkg/util/hack",
        "//pkg/util/logutil",
        "//pkg/util/memory",
        "//pkg/util/syncutil",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@org_golang_x_sys//cpu",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "chunk_test",
    timeout = "short",
    srcs = [
        "alloc_test.go",
        "chunk_in_disk_test.go",
        "chunk_test.go",
        "chunk_util_test.go",
        "codec_test.go",
        "column_test.go",
        "iterator_test.go",
        "list_test.go",
        "main_test.go",
        "mutrow_test.go",
        "pool_test.go",
        "row_container_test.go",
        "row_in_disk_test.go",
    ],
    embed = [":chunk"],
    flaky = True,
    race = "on",
    shard_count = 50,
    deps = [
        "//pkg/config",
        "//pkg/parser/mysql",
        "//pkg/sessionctx/stmtctx",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util/collate",
        "//pkg/util/memory",
        "//pkg/util/sqlkiller",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
